package com.easytopit.demo.spring.mvc.controller;

import java.text.SimpleDateFormat;
import java.util.Date;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/i18n")
public class I18nController {
	
	@GetMapping("/jsp")
	public String jsp(HttpServletRequest request){
		// 传递参数
		request.setAttribute("date", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
		request.setAttribute("name", "小明");
		return "i18n"; // WEB-INF/views/i18n.jsp
	}
	
	@GetMapping("/ftl")
	public String ftl(HttpServletRequest request){
		// 传递参数
		request.setAttribute("date", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
		request.setAttribute("name", "小明");
		return "i18n_"; // WEB-INF/views/ftl/i18n_.ftl
	}

}
